<?php
declare(strict_types=1);
namespace App\Controller\Api\V1\Home;

use App\Controller\Api\BaseController;
use App\Core\Log;
use App\Helper\Utils;
use App\Repositories\AdDatumRepository;
use App\Repositories\CmsPostRepository;
use App\Repositories\SysConfigRepository;
use App\Services\UserService;
use Hyperf\Di\Annotation\Inject;

class IndexController extends BaseController{
    /**
     * @Inject
     * @var UserService
     */
    protected $user_service;
    /**
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function index(){
        $return=[];
//        $articles = CmsPostRepository::getInstance()->getList(['id','title','thumb','created_at'],[[
//            'field' => 'category_id',
//            'value' => 1
//        ]],4,[[
//            'field' => 'id',
//            'sort' => 'desc'
//        ]]);
//        $return['articles'] = $articles;
        $return['online_check'] = config('common.online_check');
        $swipers = AdDatumRepository::getInstance()->getList(['id','title','file','url'],[[
            'field' => 'space_id',
            'value' => 1
        ]],3,[[
            'field' => 'id',
            'sort' => 'desc'
        ]]);
        $return['swipers'] = $swipers;
        return $this->response->success($return);
    }
}